import 'package:flutter/material.dart';
import 'package:tender_flutter/constant/resource_path.dart';
import 'package:tender_flutter/constant/theme_colors.dart';
import 'package:tender_flutter/router/router.dart';
import 'package:tender_flutter/style/font_style.dart';
import 'package:tender_flutter/utils/screen_adaper.dart';
import 'package:tender_flutter/widgets/base_appbar.dart';

class PublishSuccessPage extends StatefulWidget {
  @override
  _PublishSuccessPageState createState() => _PublishSuccessPageState();
}

class _PublishSuccessPageState extends State<PublishSuccessPage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
        child: Scaffold(
          backgroundColor: ThemeColors.colorWhite,
          // appBar: _initAppBar(),
          body: _initBody(),
        ),
        onWillPop: () async {
          LRouter.navigatorCtx(context).popUntilRoot();
          return true;
        });
  }

  /// 导航
  Widget _initAppBar() {
    return BaseAppBar(
      context,
      Text("发布结果", style: FonStyle.navTextStyle()),
      backgroundColor: ThemeColors.colorWhite,
    );
  }

  /// 内容体
  Widget _initBody() {
    return Container(
      width: double.infinity,
      child: Column(
        children: <Widget>[
          Image.asset(
            RPath.imgPath + "img_publish_success.png",
            fit: BoxFit.fill,
            width: double.infinity,
          ),
          SizedBox(height: ScreenAdapter.height(80)),
          Container(
              margin:
                  EdgeInsets.symmetric(horizontal: ScreenAdapter.width(100)),
              child: Text(
                "恭喜您，已提交成功，我们将在1~2个工作日内完成审核，请随时查收！",
                textAlign: TextAlign.center,
                style: TextStyle(
                    color: ThemeColors.colorType24,
                    fontSize: ScreenAdapter.sp(30),
                    fontWeight: FontWeight.w500),
              )),
          SizedBox(height: ScreenAdapter.height(150)),
          Container(
            margin: EdgeInsets.only(
                left: ScreenAdapter.width(80),
                right: ScreenAdapter.width(80),
                top: ScreenAdapter.height(90)),
            width: double.infinity,
            height: ScreenAdapter.height(90),
            child: FlatButton(
              color: ThemeColors.colorType12,
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(ScreenAdapter.width(14)),
              ),
              child: Text(
                "完成",
                style: TextStyle(
                    color: ThemeColors.colorWhite,
                    fontSize: ScreenAdapter.sp(30)),
              ),
              onPressed: () {
                LRouter.navigatorCtx(context).popUntilRoot();
              },
            ),
          )
        ],
      ),
    );
  }
}
